//
//  MainViewController.m
//  XGNewFeature
//
//  Created by 小果 on 2017/2/25.
//  Copyright © 2017年 小果. All rights reserved.
//

#import "MainViewController.h"
#import "Masonry.h"
#import "XGNewFeatureView.h"

@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setupUI];
    
    BOOL isNewVision = YES;
    if (isNewVision) {
        [self loadNewFeatureView];
    }
}

#pragma mark - 隐藏状态栏
- (BOOL)prefersStatusBarHidden {
    return YES;
}

#pragma mark - 加载新特性界面
- (void)loadNewFeatureView {
    
    XGNewFeatureView *newfeature = [[XGNewFeatureView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:newfeature];
    
    newfeature.imageNames = [self loadNewFeatureData];
}

#pragma mark - 加载数据
- (NSArray *)loadNewFeatureData {
    NSMutableArray *arryM = [NSMutableArray array];
    for (int i = 0; i < 4; i++) {
        NSString *imgName = [@"common_h" stringByAppendingFormat:@"%zd",i + 1];
        [arryM addObject:imgName];
    }
    return arryM.copy;
}

#pragma mark - 设置界面
- (void)setupUI {
    CGFloat margin = 20;
    
    UIImage *mainImage = [UIImage imageNamed:@"cozy-control-car"];
    UIImageView *imageV = [[UIImageView alloc] initWithImage:mainImage];
    // 图片的填充模式
    imageV.contentMode = UIViewContentModeScaleAspectFit;
    
    [self.view addSubview:imageV];
    
    [imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(self.view);
        make.left.equalTo(self.view).offset(margin);
        make.right.equalTo(self.view).offset(-margin);
    }];
}

@end
